﻿#ifndef VOLUMEBUTTON_H
#define VOLUMEBUTTON_H

#if defined(_MSC_VER) && (_MSC_VER >= 1600)
# pragma execution_character_set("utf-8")
#endif

#include <QToolButton>

QT_FORWARD_DECLARE_CLASS(QMenu)
QT_FORWARD_DECLARE_CLASS(QLabel)
QT_FORWARD_DECLARE_CLASS(QSlider)

class VolumeButton : public QToolButton
{
    Q_OBJECT
    Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)

public:
    explicit VolumeButton(QWidget *parent = nullptr);

    int volume();

public slots:
    void increaseVolume();
    void descreaseVolume();
    void setVolume(int volume);
    void stylize();
    void onVolumeChanged(int volume);
    void onMuteChanged(bool mute);

signals:
    void volumeChanged(int volume);
    void muteChanged(bool mute);

private:
    QMenu *menu = nullptr;
    QLabel *label = nullptr;
    QSlider *slider = nullptr;
    QToolButton *butMute;
};

#endif // VOLUMEBUTTON_H
